package com.linzm.structuraltype.filter03.criteria;

import com.linzm.structuraltype.filter03.Person;

import java.util.ArrayList;
import java.util.List;

import static com.linzm.structuraltype.filter03.enums.CriteriaTypeEnum.MALE;

/**
 * @Author zimingl
 * @Date 2023/4/16 0:35
 * @Description: CriteriaMale
 */
public class CriteriaMale implements Criteria {
    @Override
    public List<Person> meetCriteria(List<Person> persons) {
        List<Person> malePersons = new ArrayList<>();
        for (Person person : persons) {
            if (MALE.name().equalsIgnoreCase(person.getGender())) {
                malePersons.add(person);
            }
        }
        return malePersons;
    }
}
